package com.hnichr.crm.common.specification.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.hnichr.crm.common.product.entity.CrmProduct;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

/**
 * 规格对象 crm_specification
 *
 * @author Cheng
 * @date 2022-11-24
 */
@Data
@Entity
@Table(name = "crm_specification")
@Schema(description = "规格表")
@EqualsAndHashCode(callSuper = false)
public class CrmSpecification extends BaseEntity {

    /**
     * 主键
     */
    @Id
    @Generator
    @Schema(description = "主键")
    @Column(name = "id", length = 36)
    private String id;
    /**
     * 规格名称
     */
    @Schema(description = "规格名称")
    @Column(name = "spec_name", length = 64)
    private String specName;
    /**
     * 项目ID
     */
    @Schema(description = "项目ID")
    @Column(name = "product_id")
    @Dict(dicEntity = CrmProduct.class, dicCode = "id", dicText = "name")
    private String productId;
    /**
     * 项目名称
     */
    @Schema(description = "项目名称")
    @Column(name = "product_name", length = 255)
    private String productName;
    /**
     * 版本
     */
    @Schema(description = "版本")
    @Column(name = "spec_version", length = 64)
    private String specVersion;
    /**
     * 版本提交时间
     */
    @Schema(description = "版本提交时间")
    @Column(name = "submit_time")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date submitTime;
    /**
     * 批次
     */
    @Schema(description = "批次")
    @Column(name = "batch_id", length = 64)
    private String batchId;
    /**
     * 关联用户
     */
    @Schema(description = "关联用户")
    @Column(name = "link_user", length = 255)
    private String linkUser;

}
